package com.qyc.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.qyc.dto.AddOrUpDateDiseaseRecordDTO;
import com.qyc.mapper.DiseaseRecordMapper;
import com.qyc.pojo.Disease;
import com.qyc.pojo.DiseaseRecord;
import com.qyc.service.DiseaseService;
import com.qyc.mapper.DiseaseMapper;
import com.qyc.utils.BeanCopyUtils;
import com.qyc.utils.ResponseResult;
import com.qyc.vo.DiseaseQueryPageVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Objects;

/**
* @author qinyc
* @description 针对表【manager_disease(疾病类型表)】的数据库操作Service实现
* @createDate 2023-06-26 11:47:36
*/
@Service
public class DiseaseServiceImpl extends ServiceImpl<DiseaseMapper, Disease>
    implements DiseaseService{

    //注入病症Mapper层对象
    @Autowired
    private DiseaseMapper diseaseMapper;

    /**
     * @Author qinyc
     * @Description  查询所有病症类型信息
     * @version: v1.0
     * @Date 11:59 2023/6/26
     **/
    @Override
    public ResponseResult queryAllDisease() {
        //查询所有病症类型信息
        List<Disease> diseases = diseaseMapper.selectList(null);
        //返回统一响应信息
        return ResponseResult.success(diseases);
    }

    /**
     * @Author qinyc
     * @Description  分页多条件查询病症记录
     * @version: v1.0
     * @Date 12:16 2023/6/26
     **/
    @Override
    public ResponseResult queryPage(Integer pageNum,Integer pageSize, String drDId, String drStatus) {
        //开启PageHelper分页插件
        PageHelper.startPage(pageNum,pageSize,true);
        //核心查询语句
        List<DiseaseQueryPageVO> diseaseQueryPageVOS = diseaseMapper.queryPage(drDId,drStatus);
        //将查询到的数据封装在PageInfo对象中
        PageInfo pageInfo = new PageInfo(diseaseQueryPageVOS);
        //返回成功响应
        return ResponseResult.success(pageInfo);
    }

}




